package com.xyb.entity;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;

/**
 * 课程章节(Chapter)实体类
 *
 * @author makejava
 * @since 2021-11-10 16:43:00
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder

@Entity
@Table(name = "chapter")
public class Chapter implements Serializable {
    public interface insert {
    }

    ;

    public interface update {
    }

    ;
    private static final long serialVersionUID = -67606935468874732L;
    /**
     * 章节主键id
     */
    @Id
    private Long chapterId;
    /**
     * 课程id
     */
    @NotNull(message = "课程id不能为空", groups = {Chapter.insert.class})
    private Long courseId;
    /**
     * 章节名称
     */
    //@NotBlank(message = "章节名称不能为空", groups = {Chapter.insert.class, Chapter.update.class})
    @Length(min = 0, max = 40, message = "章节名称最大不能超过40个字符", groups = {Chapter.insert.class, Chapter.update.class})
    private String chapterName;
    /**
     * 章节描述
     */
    private String chapterDesc;
    /**
     * 使用状态 0失效 1 在用
     */
    private Integer status;
    /**
     * 显示顺序
     */
    private Integer showOrder;

    @OneToMany(targetEntity = CourseDetail.class)
    private List<CourseDetail> courseDetailList;
}